package com.swsc.solarverse.common.enums;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;

/**
 * @Author anonymous
 * @Date 2023/9/19 16:09
 * @Version 1.0
 * @Description
 */
@lombok.AllArgsConstructor
@lombok.Getter
public enum FaultCategoryEnum {
    IR("IR", "IR故障"),
    EL("EL", "EL故障"),
    IV("IV", "IV故障"),
    EC("EC", "集电线路故障"),

    LE("LE", "组串低效"),

    WT("WT", "风机故障"),
    ;

    private String code;
    private String name;

    public static List<String> getFaultCategoryCollectionIR(){
        return Arrays.asList(IR.getCode());
    }
    public static List<String> getFaultCategoryCollectionEL(){
        return Arrays.asList(EL.getCode());
    }
    public static List<String> getFaultCategoryCollectionIV(){
        return Arrays.asList(IV.getCode());
    }
    public static List<String> getFaultCategoryCollectionLE(){
        return Arrays.asList(LE.getCode());
    }
    public static List<String> getFaultCategoryCollectionEC(){
        return Arrays.asList(EC.getCode());
    }
    public static List<String> getFaultCategoryCollectionWT(){
        return Arrays.asList(WT.getCode());
    }
    public static List<String> getFaultCategoryCollectionMix(){
        return Arrays.asList(IR.getCode(), EL.getCode(), IV.getCode(), LE.getCode(),EC.getCode(),WT.getCode());
    }

    public static boolean isMix(Collection<String> coll){
        if(null == coll || coll.size() <= 1){
            return false;
        }
        int cnt = 0;
        for(FaultCategoryEnum e : FaultCategoryEnum.values()){
            if(coll.contains(e.getCode())){
                cnt++;
            }
        }
        return cnt > 1;
    }
}
